﻿using de.wolfmarco.pas.Accounting.Database;
using de.wolfmarco.pas.Shared.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace de.wolfmarco.pas.Accounting.MVVM
{
    /// <summary>
    /// Interaktionslogik für ScheduledCashFlowEditView.xaml
    /// </summary>
    public partial class ScheduledCashFlowEditView : UserControl
    {
        public ScheduledCashFlowEditView(ScheduledCashFlow dto)
        {
            InitializeComponent();

            DataContext = new ScheduledCashFlowEditViewModel(dto);

            ComboBoxHelper.SetItemsSource(direction, typeof(CashFlowDirectionEnum) );
            ComboBoxHelper.SetItemsSource(loop, typeof(CashFlowLoopEnum));
            ComboBoxHelper.SetItemsSource(rhythm, typeof(CashFlowRhythmEnum));

            BindingHelper.BindElementToDefaultProperty(direction, ScheduledCashFlow.DirectionProperty);
            BindingHelper.BindElementToDefaultProperty(amountOfMoney, ScheduledCashFlow.AmountOfMoneyProperty);
            BindingHelper.BindElementToDefaultProperty(loop, ScheduledCashFlow.LoopProperty);
            BindingHelper.BindElementToDefaultProperty(rhythm, ScheduledCashFlow.RhythmProperty);
            BindingHelper.BindElementToDefaultProperty(startDate, ScheduledCashFlow.StartDateProperty);
            BindingHelper.BindElementToDefaultProperty(endDate, ScheduledCashFlow.EndDateProperty);
            BindingHelper.BindElementToDefaultProperty(description, ScheduledCashFlow.DescriptionProperty);
        }
    }
}
